|
![](/i/fill.gif) |
Chris Huff wrote:
> The object pattern will only work for objects that are solid, and it
> isn't very friendly with the isosurface solving method. It is a "block
> pattern", and has only one of two states...basically meaning it has an
> infinite max_gradient. The isosurface algorithm can't easily cope with
> this.
I'm coming into this late and ignorant (haven't even compiled megapov
yet), so ignore me if I say something too stupid ...
Rune asked for a "function" equivalent to a given cone. What about
having this mean a function of the angle between the point in question,
the tip of the cone and the axis of the cone, ranging from 0 (axis,
outside) to 1 (axis, inside), adjusted so that a point on the surface of
the cone has function value 1/2 ?
The base of the cone can be represented by a ramp function, and thus the
whole finite cone function is the min() of these two.
To illustrate, suppose a standard cone has its apex at the origin, its
base at y=-1, and a 45 degree slope ...
float cone (float x, float y, float z)
{
float r = sqrt(x*x+z*z);
return 0.5 - atan2(y+r,r)/pi;
}
float cone_base (float x, float y, float z)
{
if (y<-2) return 0;
if (y>0) return 1;
return 1+y/2;
}
float finite_cone (float x, float y, float z)
{
return min( cone(x,y,z), cone_base(x,y,z) );
}
--
Anton Sherwood -- br0### [at] p0b0x com -- http://ogre.nu/
Post a reply to this message
|
![](/i/fill.gif) |